export default {
	data() {
		return {
			userInfo: {
				coin: ''
			},
		};
	},
	async onShow() {
		await this.getUserInfo()
	},
	methods: {
		onRefresh() {
			console.log('监听下拉刷新~~~~~')
		},
		// 获取个人信息
		async getUserInfo() {
			var res = await this.$get('server/login/loaduser');
			if (res.errcode != 0) {
				this.$toast(res.errmsg);
				return;
			}
			this.userInfo = res.data.user

			console.log(`http://reg.wdmanghe.com/?shangji=${this.userInfo.id}`)
		},
		// 跳转到钱包
		onWalletClick(index) {
			this.$navTo('pages/mine/wallet/wallet', {
				index: index
			})
		},
		toOrder(type) {
			this.$navTo('pages/mine/order/order', {
				type: type
			})
		},
		toStore(type) {
			this.$navTo('pages/store/store', {
				type: type
			})
		},
		// 退出登录
		onLoginOut() {
			this.$showModal({
				title: "提示",
				content: "确认退出登录",
				success: res => {
					if (res.confirm) {
						this.$store.clear()
						this.$reLaunchTo('pages/login/login')
					} else if (res.cancel) {
						console.log('用户点击取消');
					}
				}
			});
		},
	}
}
